package com.hanma.service.impl;

import java.util.Collections;
import java.util.List;

import com.hanma.bean.News;
import com.hanma.dao.NewsDao;
import com.hanma.dao.impl.NewsDaoImpl;
import com.hanma.service.NewsService;

public class NewsServiceImpl implements NewsService{

	@Override
	public boolean insert(News news) {
		NewsDao dao = new NewsDaoImpl();
		int num = dao.insert(news);
        return num > 0;
    }

	@Override
	public boolean update(News news) {
		NewsDao dao = new NewsDaoImpl();
		int num = dao.update(news);
        return num > 0;
    }

	@Override
	public boolean delete(Integer id) {
		NewsDao dao = new NewsDaoImpl();
		int num = dao.delete(id);
		return num > 0;
	}

	@Override
	public News find(Integer id) {
		NewsDao dao = new NewsDaoImpl();
		return dao.find(id);
	}

	@Override
	public boolean incrementNewsClickCount(Integer id) {
		NewsDao dao = new NewsDaoImpl();
		int num = dao.incrementNewsClickCount(id);
		return num > 0;
	}

	@Override
	public boolean commentClick(Integer id) {
		NewsDao dao = new NewsDaoImpl();
		int num = dao.commentClick(id);
		return num > 0;
	}

	@Override
	public List<News> findAllSearch(String search) {
		NewsDao dao = new NewsDaoImpl();
		return dao.findAllSearch(search);
	}

	@Override
	public List<News> findAllOne(Integer cate_id) {
		NewsDao dao = new NewsDaoImpl();
		return dao.findAllOne(cate_id);
	}

	@Override
	public List<News> findAllTwo(Integer se_cate_id) {
		NewsDao dao = new NewsDaoImpl();
		return dao.findAllTwo(se_cate_id);
	}

	@Override
	public List<News> findAllRec() {
		NewsDao dao = new NewsDaoImpl();
		return dao.findAllRec();
	}

	@Override
	public List<News> findAllSearch(String search, Integer start, Integer size) {
		NewsDao dao = new NewsDaoImpl();
		return dao.findAllSearch(search,start,size);
	}

	@Override
	public List<News> findAllOne(Integer cate_id, Integer start, Integer size) {
		NewsDao dao = new NewsDaoImpl();
		return dao.findAllOne(cate_id, start, size);
	}

	@Override
	public List<News> findAllTwo(Integer se_cate_id, Integer start, Integer size) {
		NewsDao dao = new NewsDaoImpl();
		return dao.findAllTwo(se_cate_id,start,size);
	}

	@Override
	public List<News> findAllRec(Integer start, Integer size) {
		NewsDao dao = new NewsDaoImpl();
		return dao.findAllRec(start,size);
	}

	@Override
	public List<News> findAllByState() {
		NewsDao dao = new NewsDaoImpl();
		return dao.findAllByState();
	}

	@Override
	public List<News> findAllByState(Integer start, Integer size) {
		NewsDao dao = new NewsDaoImpl();
		return dao.findAllByState(start,size);
	}

}
